﻿using BySoft.Server.Common;
using BySoft.Server.Common.Entity;
using BySoft.Server.DataAccess;
using BySoft.Server.DataAccess.UserCode;
using OneSoft.DataAccess;
using OneSoft.EntityCore;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace BySoft.Server.Business
{
    public partial class BsOutrepair
    {

        public static bool IsBillIDExists(string OutrepairIDValue)
        {

            return ClsComm.CheckExist("BS_Outrepair", "BillID", OutrepairIDValue, true);

        }
        public static bool CheckUsed(string BillIDValue)
        {
            // return
            return ClsComm.CheckExist("BS_OutBackMat", "OutOrderID", BillIDValue, true);

        }
        public static bool SaveOrUpdate(BsOutrepairEntity entity, bool isNew)
        {
            return BsOutrepairDA.SaveOrUpdate(entity, isNew);
        }

        public static bool Del(string strCode)
        {
            return BsOutrepairDA.Del(strCode);
        }

        public static DataTable SelectList(string strBillID, string strWorkOrderNo, string strSupplierID, string strFrom, string strEnd, int pageIndex, int PageSize, out int m_count)
        {
            return BsOutrepairDA.SelectList(strBillID, strWorkOrderNo, strSupplierID, strFrom, strEnd, pageIndex, PageSize, out m_count);
        }
        public static DataTable SelectOutNeedRepairDetail(string strCurrentReturnBillID, string strBillID, string strWorkOrderNo, string strSupplierID, string strProcessID
            , int pageIndex, int PageSize, out int m_count)
        {
            return BsOutrepairDA.SelectOutNeedRepairDetail(strCurrentReturnBillID, strBillID, strWorkOrderNo, strSupplierID, strProcessID, pageIndex, PageSize, out m_count);
        }

        public static DataTable SelectOutNeedRepairDetail(string strCurrentReturnBillID, string strBillID)
        {
            int pageIndex = 0;
            int PageSize = 100;
            int m_count = 0;

            return BsOutrepairDA.SelectOutNeedRepairDetail(strCurrentReturnBillID, strBillID, null, null, null, pageIndex, PageSize, out m_count);
        }
        public static DataTable SelectMatNeedRepairNum(string strCurrentReturnBillID, string sendID, string materialID)
        {
            return BsOutrepairDA.SelectMatNeedRepairNum(strCurrentReturnBillID, sendID, materialID);
        }
        public static DataTable SelectHeadData(string strBillID)
        {
            return BsOutrepairDA.SelectHeadData(strBillID);
        }
        //public static DataTable SelectDetailData(string strBillID)
        //{
        //    return BsOutrepairDA.SelectDetailData(strBillID);
        //}


        public static DataTable CreateDT()
        {

            DataTable dt = SelectHeadData("-1");
            return dt;

        }


    }
}
